package com.ysx.oa.teacher;


import com.ysx.oa.teacher.bean.TeacherBean;
import com.ysx.oa.teacher.dao.TeacherDao;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = TeacherApplication.class)
public class TeacherDaoTest {

    @Autowired
    private TeacherDao dao;



    @Test
    public void update(){
        TeacherBean teacher= new TeacherBean();
        teacher.setId(800200);
        teacher.setTeacherName("校级考勤管理员");
        dao.updateByPrimaryKey(teacher);
    }

    @Test
    public void delete2(){
        TeacherBean teacher= new TeacherBean();
        teacher.setTeacherName("对对对");
        dao.delete(teacher);
    }


    @Test
    public void delete1(){

        TeacherBean teacher= new TeacherBean();
        teacher.setId(999);
        dao.delete(teacher);

    }
    @Test
    public void add(){

        TeacherBean teacher= new TeacherBean();
        teacher.setId(999);
        teacher.setTeacherName("55555");
        dao.insert(teacher);

    }

    @Test
    public void findById(){

        TeacherBean teacher= new TeacherBean();
        teacher.setId(800200);

        System.out.println(dao.selectOne(teacher));

    }


}
